package com.hg.chapter6.controller;

import com.hg.chapter6.datadict.People;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class ValueController {

    @Value("${people.name}")
    private String name;

    @Value("${people.age}")
    private int age;

    @Autowired
    private People people;

    @GetMapping("/people")
    public String get() {
        return "name:" + name + " age:" + age;
    }

    @GetMapping("/people/new")
    public String get1() {
        return "new !!! name:" + people.getName() + " age:" + people.getAge();
    }
}
